package com.example.libretranslatemobile;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.google.android.material.textfield.TextInputLayout;

public class FieldsAdapter extends RecyclerView.Adapter<FieldsAdapter.FieldViewHolder>{
    private final int numberItems;
    public FieldsAdapter(int numberItems){
        this.numberItems = numberItems;
    }

    @NonNull
    @Override
    public FieldViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        View view = inflater.inflate(R.layout.main_item, parent, false);

        return new FieldViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull FieldViewHolder holder, int position) {
    }

    @Override
    public int getItemCount() {
        return numberItems;
    }

    static class FieldViewHolder extends RecyclerView.ViewHolder{

        TextInputLayout listInputLayout;
        EditText listItemFieldView;

        public FieldViewHolder(@NonNull View itemView) {
            super(itemView);
            listInputLayout = itemView.findViewById(R.id.rv_text_input_layout);
            listItemFieldView = itemView.findViewById(R.id.rv_field);
        }
    }
}
